$(function() {
	$('#recoveryForm').bootstrapValidator({
		live : 'disabled',
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating: 'glyphicon glyphicon-refresh'
		},
		fields : {
			email : {
				validators : {
					notEmpty : {
						message : '邮箱不能为空.'
					},
					emailAddress : {
						message : '邮箱地址非法.'
					},
					stringLength : {
						max : 30,
						message : '必须在30字符长度之内.'
					},
					remote: {
						url: ctxPath + '/checkEmailExist.do',
						message: '邮箱不存在.'
					}
				}
			}
		},
		submitHandler: function(validator, form, submitButton) {
			var email = $("#email").val(); 
			var url = ctxPath + "/sys/user/pwdRecovery.do";
			var data = {"email": email};
			doPostReq(url, data, function() {
				location.href = ctxPath + "/recoveryConfirm.html";
			});
		}
	});
	
	$('#submitBtn').click(function() {
		$("#recoveryForm").submit();
    });
	
});